import request from '@/utils/request'

//test
export function Test(query){
  return request({
    url:'/list',
    method:'get',
    params:query
  })
}



// // 查询报名签到签退列表
// export function listUserEvent(query) {
//   return request({
//     url: '/volunteer/user/list',
//     method: 'get',
//     params: query
//   })
// }

//按条件搜索
export function listUsersEvent(data){
  return request({
    url:'/volunteer/user/list',
    method:'post',
    data:data
  })
}

// 查询报名签到签退详细
export function getUserEvent(userId) {
  return request({
    url: '/volunteer/user/' + userId,
    method: 'get'
  })
}

// 活动报名
export function reportUserEvent(eventId,userId) {
  return request({
    url: '/volunteer/user/report/'+eventId+'/'+userId,
    method: 'put',
    data:{
      eventId,
      userId
    }
  })
}

// 取消报名
export function delReport(userId,eventId) {
  return request({
    url: '/volunteer/user/'+userId+'/'+eventId,
    method: 'delete',
    data:{
      userId,
      eventId,
    }
  })
}


//审核通过志愿者
export function check_ok(userId,eventId) {
  return request({
    url: '/volunteer/user/check_ok/'+userId+'/'+eventId,
    // url: '/volunteer/user/check_ok/',
    method: 'post',
    data:{
      userId,
      eventId
    }
  })
}

//审核不通过志愿者
export function check_fail(userId,eventId) {
  return request({
    url: '/volunteer/user/check_fail/'+userId+'/'+eventId,
    // url: '/volunteer/user/check_ok/',
    method: 'post',
    data:{
      userId,
      eventId
    }
  })
}


// 新增报名签到签退
export function addUserEvent(data) {
  return request({
    url: '/volunteer/user/add',
    method: 'post',
    data: data
  })
}

// 修改报名签到签退
export function updateUserEvent(data) {
  return request({
    url: '/volunteer/user',
    method: 'put',
    data: data
  })
}

// 删除报名签到签退
export function delUserEvent(userId) {
  return request({
    url: '/volunteer/user/' + userId,
    // url: '/volunteer/user/1' ,
    method: 'delete'
  })
}

//活动签到
export function signUp(userId,eventId) {
  const data = {
    userId,
    eventId
  }
  return request({
    url : '/volunteer/user/sign_up',
    method : 'put',
    data : data
  })
}


//活动签退
export function signOut(userId,eventId) {
  const data = {
    userId,
    eventId
  }
  return request({
    url: '/volunteer/user/sign_out',
    method: 'put',
    data: data
  })
}
  //获取下拉树结构
 export function treeEventSeqlect() {
   return request({
     url: 'volunteer/event/treeEventSelect',
     method: 'get'

   })
 }




